CORE_DIR=core
PLUGINS_DIR=plugins
TOOLS_DIR=tools

#TARGET=plugins core
TARGET=core tests
.PHONY:${TARGET}
all:${TARGET}
${TARGET}:
	make -C $@
clean:
	make -C core clean
	make -C tests clean

INSTALL_PATH=/usr/
ifdef DESTDIR
	INSTALL_PATH=$(DESTDIR)
else ifdef prefix
	INSTALL_PATH=$(prefix)
else
	INSTALL_PATH=/usr/
endif

INC=$(shell find ./libs/ ./include/  -maxdepth 1 | grep '\.h$$')

install:
	make -C core install DESTDIR=$(INSTALL_PATH)/lib64
	mkdir -p $(INSTALL_PATH)/include/uos-sysmonitor
	cp $(INC) $(INSTALL_PATH)/include/uos-sysmonitor/
	mkdir -p $(INSTALL_PATH)/share/uos-sysmonitor
	cp -a ./tests/* $(INSTALL_PATH)/share/uos-sysmonitor/
	mkdir -p $(INSTALL_PATH)/bin
	install -m 755 ./tests/test-monitor* $(INSTALL_PATH)/bin/
uninstall:
	make -C core uninstall DESTDIR=$(INSTALL_PATH)/lib64
	rm -rf $(INSTALL_PATH)/include/uos-sysmonitor
	rm -rf $(INSTALL_PATH)/share/uos-sysmonitor
	rm -f  $(INSTALL_PATH)/bin/test-monitor*


